<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/5/3
  Time: 20:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>模拟考试</title>

    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/style.min.css" rel="stylesheet">

    <script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
    <style>
        .numbutton {
            height: 60px;
            width: 70px;
            margin: 15px;
            font-size: 20px;
            font-weight: bold;

            /*background: white;*/
            /*border: solid 1px;*/
        }

        .numbutton2 {
            height: 60px;
            width: 140px;
            margin: 20px;
            font-size: 20px;
            font-weight: bold;

        }
        .form-group{
            margin-top: 20px;
        }
        .btng{
            height: 30px;
            width: 80px;
            font-weight: bold;
            margin-left: 10px;
            margin-right: 10px;
        }
        label,button{
            color: black;
        }
        label{
            font-size: 17px;
            font-weight: 500;
        }
        .container-fluid{
            margin-top: 50px;
        }
    </style>
</head>

<body>
<div class="container-fluid">

    <div class="row">
        <div class="col-md-4 col-md-offset-2" style="background:rgba(164,164,164,0.39);width: 410px;height: 370px">
            <form class="form-horizontal">
                <h3 style="margin-top: 25px;margin-bottom: 25px;color: black">考生信息：</h3>
                <div class="form-group">
                    <label class="col-sm-4 control-label">学生姓名：</label>
                    <div class="col-sm-7">
                        <input type="text" readonly placeholder="xxx" class="form-control" id="username">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4  control-label">证件类型：</label>
                    <div class="col-sm-7">
                        <input type="text" readonly placeholder="居民身份证" class="form-control">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4  control-label">证件号码：</label>
                    <div class="col-sm-7">
                        <input id="idcard" type="text" placeholder="" class="form-control" value="">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-4  control-label">驾照类型：</label>
                    <div class="col-sm-7">
                        <input type="text" readonly placeholder="c1.c2.c3.c4" class="form-control" id="car">
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-offset-3 col-sm-8">
                        <button class="btng" type="button" onclick="tijaio()">确 定</button>
                        <button class="btng" type="button">取 消</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="col-md-4" style="background:rgba(164,164,164,0.39);margin-left: 10px;width: 450px">
            <div>
                <button onclick="add(1)" class="numbutton ">1</button>
                <button onclick="add(2)" class="numbutton ">2</button>
                <button onclick="add(3)" class="numbutton ">3</button>
                <button onclick="add(4)" class="numbutton ">4</button>
                <button onclick="add(5)" class="numbutton ">5</button>
                <button onclick="add(6)" class="numbutton ">6</button>
                <button onclick="add(7)" class="numbutton ">7</button>
                <button onclick="add(8)" class="numbutton ">8</button>
                <button onclick="add(9)" class="numbutton ">9</button>
                <button onclick="add(0)" class="numbutton ">0</button>
                <button onclick="add('x')" class="numbutton">x</button>
                <button  onclick="shanOne()" class="numbutton2">回 退</button>
                <button onclick="rese()" class="numbutton2">重 置</button>
            </div>
        </div>
    </div>
</div>

<script>
    var $idc = $("#idcard");
    var courseId;

    function add(key) {
        var pr = $idc.val();
        if(pr.length>18){
            layer.msg("亲，身份证最多18位哦",{icon:2,time:1000});
            return false;
        }
        $idc.val(pr+''+key)
    }
    function shanOne() {
        var pr = $idc.val();
        $idc.val(pr.slice(0,pr.length-1))
    }

    function rese() {
        $idc.val("")
    }
    $(function () {
       var car= getQueryString("text");
       courseId=getQueryString("courseId");
       var username=getQueryString("username");
       $("#username").val(username);
       $("#car").val(car);
    })
    function getQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]); return null;
    }
//    /**
//     *  跳转到模拟考试界面
//     * @author tsl
//     * @date 2018/4/28 9:52
//     * @param type 1汉 2藏
//     * @param courseId 科目id
//     * @param status 模拟考试 1
//     * @return
//     */
//    @RequestMapping(value = "/test/{type}-{status}-{number}-{courseId}.html",method = RequestMethod.GET)
    function tijaio() {
        window.parent.exportData("/test/1-1-"+$idc.val()+"-"+courseId+".html");
        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
        parent.layer.close(index);
    }
</script>

</body>
</html>
